﻿using System.Collections;
using System.Collections.Generic;
using DevExpress.Data;
using Zdm.Crm.Client.Entity.Entity;

namespace Zdm.Crm.Client.Winform.Utilies
{
    public class Entities<T> : List<T>, IRelationList where T : BaseEntity
    {

        public List<T> InnerList
        {
            get
            {
                return new List<T>(this);
            }

        }
        public Entities()
        {

        }

        public Entities(IEnumerable<T> ie)
            : base(ie)
        {
        }

        public string GetRelationName(int index, int relationIndex)
        {
            return "Detail";
        }

        public bool IsMasterRowEmpty(int index, int relationIndex)
        {
            return false;
        }

        public IList GetDetailList(int index, int relationIndex)
        {
            return this[index].Detail;
        }

        public int RelationCount
        {
            get { return 1; }
        }
    }
}
